import {
	getCommunityInfo, //获取小区物业端情况
	operaOrder,//操作订单
	device,//设备
} from '@/api/communityApi'
import {
	getStore,
	setStore
} from '@/util/service'
const community = {
	namespaced: true,
	state: {
		communityInfo: getStore('communityInfo') || {},
		currentArea:getStore('currentArea')||0,
	},
	getters: {},
	mutations: {
		SET_COMMUNITYINFO:(state, params) => {
			state.communityInfo = params;
			setStore('communityInfo', params);
		},
		SET_CURRENTAREA:(state, params) => {
			state.currentArea = params;
			setStore('currentArea', params);
		},
	},
	actions: {

		//获取小区物业端情况
		GetCommunityInfo({
			state,
			commit,
			dispatch
		}, params) {
			return new Promise((resolve, reject) => {
				getCommunityInfo(params).then(res => {
					resolve(res)
				})
			})
		},	
		//操作订单
		OperaOrder({
			state,
			commit,
			dispatch
		}, params) {
			return new Promise((resolve, reject) => {
				operaOrder(params).then(res => {
					resolve(res)
				})
			})
		},
		//操作订单
		Device({
			state,
			commit,
			dispatch
		}, params) {
			return new Promise((resolve, reject) => {
				device(params).then(res => {
					resolve(res)
				})
			})
		},
	}
}
export default community
